<template>
  <!-- 服务条款、投诉、隐私政策 -->
  <view class="pages">
    <!-- <u-parse :content="info?.content"></u-parse> -->
    <up-parse :content="info?.content"></up-parse>
    <!-- <h-not-list v-if="!info.content"></h-not-list> -->
  </view>
</template>

<script setup>
import { ref } from 'vue'
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import { showToast, navigateTo, navigateBack, setNavBarTitle } from '@/utils'
import {
  getServiceAgreement,
  getPrivacyAgreement,
  getUserAgreement,
  getLogoutAgreement,
} from '@/api/patients/index.js'
const info = ref({}) //  信息
onLoad((options) => {
  getInfo(options.type)
})

async function getInfo(type) {
  try {
    if (type == 0) {
      const res = await getUserAgreement()
      info.value = res.data
      setNavBarTitle(res.data.title || '协议详情')

    } else if (type == 1) {
      const res = await getServiceAgreement()
      info.value = res.data
      console.log(info.value.content)
      setNavBarTitle(res.data.title || '协议详情')
    } else if (type == 3) {
      const res = await getLogoutAgreement()
      info.value = res.data
      setNavBarTitle(res.data.title || '协议详情')
    } else {
      const res = await getPrivacyAgreement()
      info.value = res.data
      setNavBarTitle(res.data.title || '协议详情')
    }
  } catch (error) {
    setNavBarTitle('协议详情')
  }
}
</script>

<style lang="scss" scoped>
.pages {
  width: 750rpx;
  background-color: #f5f6f8;
  min-height: 100vh;
  padding: 24rpx;
}
</style>
